package classexercise;

public class Book1 {
	private String name;
	private Author[] authors;
	private double price;
	private int qty=0;
	
	public Book1(String name,Author[] authors,double price ){
		 this.name=name;
		 this.authors=authors;
		 this.price=price;
	}
	public Book1(String name,Author[] authors,double price,int qty){
		 this.name=name;
		 this.authors=authors;
		 this.price=price;
		 this.qty=qty;
	}

	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Author[] getAuthors() {
		return authors;
	}
	public void setAuthors(Author[] authors) {
		this.authors = authors;
	}
	public double getPrice() {
		return price;
	}
	public void setPrice(double price) {
		this.price = price;
	}
	public int getQty() {
		return qty;
	}
	public void setQty(int qty) {
		this.qty = qty;
	}
	public String toString(){
		String str="";
		String b="book[name="+name+",authors={";
		//for each
		for(Author a:authors){
			str += a.toString();
			if(!a.equals(authors[authors.length-1])){
				str+=",";
			}
		}return b+str+"},prcie="+price+",qty="+qty+"]";

	}
	public String getAuthorName(){
		String b =getName()+getName();
		return b;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
